package com.szewec.ps.util;

import java.util.HashMap;
import java.util.Map;

public class OneOffCupboard {
    static final public String PUSH_DATA_SURVEYED_POINT_STRUCTURE_DETAIL_ACTIVITY = "SURVEYED_POINT_STRUCTURE_DETAIL_ACTIVITY_PUSH_DATA";

    private Map<String,Object> cupboardMap = new HashMap<>();
    static private OneOffCupboard sharedInstance = null;
    public static OneOffCupboard sharedInstance(){
        if (sharedInstance == null){
            synchronized (OneOffCupboard.class){
                if (sharedInstance == null){
                    sharedInstance = new OneOffCupboard();
                }
            }
        }
        return sharedInstance;
    }
    public void set(String key, Object obj){
        cupboardMap.put(key, obj);
    }
    public Object getThenRemove(String key){
        Object obj = cupboardMap.get(key);
        cupboardMap.remove(key);
        return obj;
    }
}
